// WebSocket 事件类型
export type WebSocketEvent = 'open' | 'close' | 'error' | 'message' | 'reconnect';

// WebSocket 消息结构
export interface WebSocketMessage<T = any> {
    type: string
    data?: T
    timestamp?: number
  }

// WebSocket 配置选项
export interface WebSocketOptions {
    url: string
    maxReconnectAttempts?: number
    reconnectInterval?: number
    heartbeatInterval?: number
  }

// WebSocket 监听器
export type WebSocketListener<T = any> = (data: T) => void